import { request } from '../../../services/request';

// 扫描工单接口
export const scanMesMBomMaterialClaimList = async (params: { qr_code: string }) => {
    console.log('扫描工单接口 - 提交参数:', params);
    try {
        const response = await request('app/mesMbomMaterial/scanMesMBomMaterialClaimList', {
            method: 'POST',
            body: JSON.stringify(params)
        });
        console.log('扫描工单接口 - 返回结果:', response);
        return response;
    } catch (error) {
        console.error('扫描工单接口 - 调用失败:', error);
        throw error;
    }
};

// 获取储位信息接口
export const getShelfByShelfNum = async (params: { shelf_num: string }) => {
    console.log('获取储位信息接口 - 提交参数:', params);
    try {
        const response = await request('app/wms/shelf/getShelfByShelfNum', {
            method: 'POST',
            body: JSON.stringify(params)
        });
        console.log('获取储位信息接口 - 返回结果:', response);
        return response;
    } catch (error) {
        console.error('获取储位信息接口 - 调用失败:', error);
        throw error;
    }
};

// 领料接口
export const claimMaterial = async (params: any[]) => {
    console.log('领料接口 - 提交参数:', params);
    try {
        const response = await request('app/materialClaim/claim', {
            method: 'POST',
            body: JSON.stringify(params)
        });
        console.log('领料接口 - 返回结果:', response);
        return response;
    } catch (error) {
        console.error('领料接口 - 调用失败:', error);
        throw error;
    }
};
